<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			// var p1 = {
			// 	name: "zhangsan",
			// 	age: 20,
			// 	sex: "男",
			// 	work: function() {
			// 		console.log("工作");
			// 	}
			// }

			// var p2 = {
			// 	name: "lisi",
			// 	age: 30,
			// 	sex: "女",
			// 	work: function() {
			// 		console.log("工作");
			// 	}
			// }

			/*
			  构造函数:
			  1.函数名首字母大小
			  2.不需要return
			  3.使用this指定属性和行为
			  
			  this代表当前对象
			*/
			function Person(name, age, sex) {
				this.name = name;
				this.age = age;
				this.sex = sex;
				this.work = function() {
					console.log("工作");
				}
			}

			Person.salary = 9000; //静态属性

			var p1 = new Person("zhangsan", 20, "男");
			// console.log(p1.name);
			var p2 = new Person("lisi", 30, "女");
			// console.log(p2.name);
			p2.height = 190;
			// console.log(p2.height);

			console.log(Person.salary);
			console.log(p1.salary);
			console.log(p2.salary);
		</script>
	</head>
	<body>
	</body>
</html>
